package com.example.sqlitelogin.tools;

//* 下面是遥控器编码

//其中引导码是我们不需要的，我们主要需要的是数据码，通过数据码的识别来控制单片机上的小灯或者其他东西
//        NEC标准下的编码表示
//        其中：引导码高电平约9000us 左右，低电平约4500us 左右；
//        用户码16 位，数据码16 位，共32位；
//        数据0 是用“高电平约560us ＋低电平约560us”表示。
//        数据1 可用“高电平约560us＋低电平约1680us”表示。

public class CodeCommandlight {
    //编码规则
    //起始码S电平宽度为：9000us低电平+4500us高电平
    public static final int startdown = 9000;
    public static final int startup = 4500;

    //连接码C电平宽度为：600us低电平+20000us高电平
    public static final int connectdown = 600;
    public static final int connectup = 20000;

    //数据码由0，1组成：
    //0的电平宽度为：600us低电平+600us高电平，
    public static final int zerodown = 600;
    public static final int zeroup = 600;

    //1的电平宽度为：600us低电平+1600us高电平
    public static final int onedown = 600;
    public static final int oneup = 1600;

    //命令格式（数组内的数值拼接）


    //模式自动数组（扫风）开机
    public static final int[] auto = {
            startdown, startup,//起始码
            onedown, oneup, onedown, oneup, zerodown, zeroup,//1-3
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//4-6
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//7-9
            onedown, oneup, onedown, oneup, onedown, oneup, //10-12
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//13-15
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//16-18
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//19-21
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//22-24
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//25-27
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//28-30
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//31-33
            onedown, oneup, zerodown, zeroup,//34-35  前35位数据码结束
            connectdown, connectup,//连接码   后32位开始
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//36-38
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//39-41
            zerodown, zeroup, zerodown, zeroup, onedown, oneup,//42-44
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//45-47
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//48-50
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//51-53
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//54-56
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//57-59
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//60-62
            zerodown, zeroup, //63
            onedown, oneup, onedown, oneup, onedown, oneup, zerodown, zeroup, //64-67(四位检验码)后32位结束
//            0110，1010
    };

    //模式自动数组（扫风）开机
    public static final int[] auto1 = {
            9000, 4500,
            600, 600, 600, 600, 600, 600,//模式0自动
            600, 1600, 600, 600, 600, 600,//开，风速自动
            600, 1600, 600, 600, 600, 600,//扫风
            600, 600, 600, 1600, 600, 1600,//28度
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 1600, 600, 600, 600, 600,//灯光开
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 1600, 600, 600,
            600, 1600, 600, 600, 600, 600,
            600, 1600, 600, 600,
            600, 20000,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 1600,//温度显示
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600, 600, 600, 600, 600,
            600, 600,
            600, 1600, 600, 1600, 600, 1600, 600, 1600
    };

    /**
     * 大数组模块
     * 全部置通用 在替换
     */

    //模式自动数组（扫风）开机
    public static final int[] base = {
            startdown, startup,//起始码
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//1-3
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//4-6
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//7-9
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//10-12
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//13-15
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//16-18
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//19-21
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//22-24
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//25-27
            zerodown, zeroup, onedown, oneup, zerodown, zeroup,//28-30
            onedown, oneup, zerodown, zeroup, zerodown, zeroup,//31-33
            onedown, oneup, zerodown, zeroup,//34-35  前35位数据码结束
            connectdown, connectup,//连接码   后32位开始
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//36-38
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//39-41
            zerodown, zeroup, zerodown, zeroup, onedown, oneup,//42-44
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//45-47
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//48-50
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//51-53
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//54-56
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//57-59
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//60-62
            zerodown, zeroup, //63
            zerodown, zeroup, zerodown, zeroup, zerodown, zeroup, zerodown, zeroup,//64-67(四位检验码)后32位结束

    };

    //校验码--1
    public static int check_d = onedown;
    public static int check_u = oneup;


}

